Skip to content

[codex] add referral invites to /usage#30313

Draft
jayp-oai wants to merge 1 commit into
mainfrom
codex/tui-referral-invites
Draft

[codex] add referral invites to /usage#30313
jayp-oai wants to merge 1 commit into
mainfrom
codex/tui-referral-invites

Conversation

@jayp-oai

@jayp-oai jayp-oai commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a temporary client-owned referral invite flow under /usage
  • call the existing ChatGPT referral HTTP endpoints directly instead of adding app-server RPC/protocol endpoints
  • reuse the embedded app-server auth session, pin user/workspace identity and confirmed reward terms, and hide the flow when a referral client is unavailable
  • require email entry plus explicit confirmation, revalidate the offer immediately before send, and send the invite with a no-retry/no-redirect POST client

Scope

  • 24 files, 1,203 additions, 26 deletions
  • no new backend endpoint or public app-server API

TUI preview

/usage

  Usage
  View account usage or redeem an earned reset.

  1. Show usage                View recent account token usage.
  2. Redeem usage limit reset  Check reset availability.
  3. Invite someone to Codex   Invite a friend and earn a usage reset.

EMAIL

  Invite someone to Codex
  Enter one email address, then press Enter.

  name@example.com

CONFIRMATION

  Send referral invite?
  Invite a friend and earn a usage reset.
  Recipient: friend@example.com
  • Your friend must be new to Codex.
  By sending, you confirm that you have this person's consent.

  1. Send invite
  2. Cancel                    (selected by default)

SENDING

  Invite someone to Codex
  Sending an invite to friend@example.com...

SUCCESS

  Invite someone to Codex
  Invite sent to friend@example.com.

HTTP request shape

GET /backend-api/referrals/invite/eligibility?referral_key=codex_referral_persistent_invite&requested_referrals=1&supports_rewardless_invites=false
GET /backend-api/wham/referrals/eligibility_rules?referral_key=codex_referral_persistent_invite

POST /backend-api/wham/referrals/invite
Content-Type: application/json

{
  "referral_key": "codex_referral_persistent_invite",
  "emails": ["friend@example.com"]
}

The client re-fetches the offer and verifies the user, workspace, reward, and rules before making the single-attempt POST.

Testing

  • cargo check -p codex-login -p codex-chatgpt -p codex-tui
  • just test -p codex-chatgpt (8 passed)
  • just test -p codex-tui referrals (7 passed)
  • just fix -p codex-login -p codex-chatgpt -p codex-tui
  • just fmt
  • git diff --check origin/main...HEAD
  • Autoreview: clean, no accepted/actionable findings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant